package cn.darkhorse.mesadmin.controller.pick;

import cn.darkhorse.pick.pojo.PickMapInfo;
import cn.darkhorse.pick.service.IPickMapInfoService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "坐标信息")
@RestController
@RequestMapping("/pick/PickMap")
public class PickMapController extends BaseController
{
    @Autowired
    private IPickMapInfoService pickMapService;

    @ApiOperation(value = "获取坐标信息列表")
    @GetMapping("/list")
    public TableDataInfo list(PickMapInfo pickMapInfo)
    {
        LambdaQueryWrapper<PickMapInfo> queryWrapper = new LambdaQueryWrapper<>();
        if (pickMapInfo.getDeviceMainCode()!=null){
            queryWrapper.like(PickMapInfo::getDeviceMainCode,pickMapInfo.getDeviceMainCode());
        }
        if (pickMapInfo.getDeviceName()!=null){
            queryWrapper.like(PickMapInfo::getDeviceName,pickMapInfo.getDeviceName());
        }
        if (pickMapInfo.getStartTime()!=null){
            queryWrapper.ge(PickMapInfo::getCreateTime,pickMapInfo.getStartTime());
        }
        if (pickMapInfo.getEndTime()!=null){
            queryWrapper.le(PickMapInfo::getCreateTime,pickMapInfo.getEndTime());
        }
        startPage();
        return getDataTable(pickMapService.list(queryWrapper));
    }

}